//
//  test.c
//  Contact
//
//  Created by Daniel on 2024/6/13.
//

#include "contact.h"

void menu(void)
{
    printf("****************************************************\n");
    printf("********      1. Add          2. Del        ********\n");
    printf("********      3. Search       4. Modify     ********\n");
    printf("********      5. Show         6. Sort       ********\n");
    printf("***************       0. Exit         **************\n");
    printf("****************************************************\n");
}
int main()
{
    int input = 0;
    Contact con;
    //initialize 初始化
    InitContact(&con);
    do
    {
        menu();
        printf("请选择:>");
        scanf("%d",&input);
        switch(input)
        {
            case 1:
                AddContact(&con);
                break;
            case 2:
                DelContact(&con);
                break;
            case 3:
                SearchContact(&con);
                break;
            case 4:
                ModifyContact(&con);
                break;
            case 5:
                ShowContact(&con);
                break;
            case 6:
                SortContact(&con);
                break;
            case 0:
                printf("退出通讯录");
                break;
            default:
                printf("选择错误\n");
                break;
        }
    }while(input);
    return 0;
}
